package com.mym.demo;

import java.util.Random;

/**
 * @author miao
 * @version 1.0
 * @date 2025/4/9 11:39
 * @description
 */
public class Test2 {
    public static void main(String[] args) {
        double[] Rectangle = new double[5];
        Random random = new Random();
        for (int i = 0; i < Rectangle.length; i++) {
            double num1=random.nextDouble(9)+1;
            double num2=random.nextDouble(9)+1;
            Rectangle[i]=num1*num2;
        }
        for (int i = 0; i < Rectangle.length; i++) {
            System.out.println(Rectangle[i]);
        }
        for (int i = 1; i < Rectangle.length; i++) {
            for (int j = 0; j < Rectangle.length-i; j++) {
                if (Rectangle[j]>Rectangle[j+1]){
                    double temp=Rectangle[j];
                    Rectangle[j]=Rectangle[j+1];
                    Rectangle[j+1]=temp;
                }
            }
        }
        for (int i = 0; i < Rectangle.length; i++) {
            System.out.println(Rectangle[i]);
        }

    }
}
